#!/bin/sh
#
# A simple script to reset a specific user's desktop settings
#

# go home
cd $HOME || { 
	echo
	echo "Ack! $HOME not found, aborting"
	echo
	exit
}

FILELIST=".screenrc .kde .kde2 .gnome_private .gconfd .gconf .nautilus .gtkrc .sawfish .gnome"

# out with the old
for f in $FILELIST
do
	if [ -e ./$f ]
	then
		rm -rf ./$f &> /dev/null
	fi
done

# in with the new
for f in $FILELIST
do
	if [ -e /etc/skel/$f ]
	then
		cp -a /etc/skel/$f . &> /dev/null
	fi
done

# copy over the default desktop icons
  # gnome
if [ -d .gnome-desktop ]
then
	cp -af /etc/skel/.gnome-desktop/. .gnome-desktop/ &> /dev/null
fi
  # kde
if [ -d .Desktop ]
then
	cp -af /usr/share/apps/kdesktop/DesktopLinks/. Desktop/ &> /dev/null
	cp -af /etc/skel/.Desktop/. Desktop/ &> /dev/null
fi

# remove "last session" settings
rm -f ./.gnome2/gdm
rm -f ./.wmrc

# run the default window manager
exec /etc/X11/xdm/Xsession

